#include "logger.h"
#include <fstream>

using namespace std;

Logger Logger::logger;

Logger& Logger::GetLogger()
{
    logger.sModule = "";
    return logger;
}

Logger& Logger::GetLogger(string nameModule)
{
    logger.sModule = nameModule;
    return logger;
}

void Logger::SetLogfile(string nameLogfile)
{
    logger.sLogfile = nameLogfile;
    return;
}

void Logger::Info(string message)
{
    fstream fLog(sLogfile.c_str(), ios::out | ios::app);
    fLog<<"--------------------"<<sModule<<"--------------------"<<endl;
    fLog<<"Info : "<<message<<endl<<endl;
    fLog.close();
    return;
}

void Logger::Error(string message)
{
    fstream fLog(sLogfile.c_str(), ios::out | ios::app);
    fLog<<"--------------------"<<sModule<<"--------------------"<<endl;
    fLog<<"Error : "<<message<<endl<<endl;
    fLog.close();
    return;
}

Logger::Logger() : sLogfile("Log.txt") { }

Logger::~Logger() { }

